const ipc = window.clientAppSdk.ipc.ipcRenderer;

function setSize(width: number, height: number) {
  ipc.send('rc:win-action', 'setSize', { width, height });
}

function setResizable(resizable: boolean) {
  ipc.send('rc:win-action', 'setResizable', resizable);
}

function setAlwaysOnTop(alwaysOnTop: boolean) {
  ipc.send('rc:win-action', 'setAlwaysOnTop', alwaysOnTop);
}

function center() {
  ipc.send('rc:win-action', 'center');
}

function setMinimumSize(width: number, height: number) {
  ipc.send('rc:win-action', 'setMinimumSize', { width, height });
}

function setOpacity(opacity: number) {
  ipc.send('rc:win-action', 'setOpacity', opacity);
}

function show() {
  ipc.send('rc:win-action', 'show');
}

function restore() {
  ipc.send('rc:win-action', 'restore');
}

function minimize() {
  ipc.send('rc:win-action', 'minimize');
}

function maximize() {
  ipc.send('rc:win-action', 'maximize');
}

function focus() {
  ipc.send('rc:win-action', 'focus');
}

function openDevTools() {
  ipc.send('rc:openDevTools');
}

export const winActions = {
  setSize,
  setResizable,
  setAlwaysOnTop,
  center,
  setMinimumSize,
  setOpacity,
  show,
  restore,
  minimize,
  maximize,
  focus,
  openDevTools
};
